#include <iostream>
#include <vector>

using namespace std;

int f(int i, int n, vector<int> &arr) {
  if (i >= n)
    return 0;
  return f(i + arr[i], n, arr) + 1;
}

int main() {
  int n, a;
  vector<int> arr;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    arr.push_back(a);
  }

  cout << f(0, n, arr) << endl;
  return 0;
}